<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSummer2022RewardSetting extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('summer2022_reward_setting', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedTinyInteger('rank')->default(0)->comment("排名");
            $table->unsignedBigInteger('reward_id')->default(0)->comment("summer2022_reward.id");
            $table->enum('reward_type', ['礼物', '其他'])->default('礼物')->comment("奖励类型: 礼物=关联 app.gift.id; 其他=activity.summer2022_reward.id;");
//            $table->string('reward_price', 50)->default('')->comment("奖励价格, int=金币, [高, 中, 低]");
            $table->unsignedInteger('reward_count')->default(1)->comment("奖励数量");
            $table->unsignedInteger('period')->default(0)->comment("有效期(天) 0=永久");
            $table->enum('is_visible', [0, 1])->comment("是否可见: 0=不可见; 1=可见;");

            $table->dateTime('created_at', 6)->default(DB::raw('CURRENT_TIMESTAMP(6)'))->comment("创建时间");
            $table->dateTime('updated_at', 6)->default(DB::raw('CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)'))->comment("更新时间");
//            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('summer2022_reward_setting');
    }
}
